﻿<Window x:Class="IS_Ever_Green.View.UserView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:IS_Ever_Green.View" 
        xmlns:viewModel="clr-namespace:IS_Ever_Green.ViewModel"
        mc:Ignorable="d"
        Height="1024" Width="1440"
        WindowStyle="None"
        ResizeMode="NoResize"
        WindowStartupLocation="CenterScreen"
        MouseDown="Window_MouseDown"
        Background="Transparent"
        AllowsTransparency="True"
        >

    <Window.DataContext>
        <viewModel:UserViewModel/>
    </Window.DataContext>

    <Window.Resources>
        <DataTemplate DataType="{x:Type viewModel:HomeUserViewModel}">
            <local:HomeUserView/>
        </DataTemplate>

        <DataTemplate DataType="{x:Type viewModel:ReadyComputerViewModel}">
            <local:ReadyComputerView/>
        </DataTemplate>

        <DataTemplate DataType="{x:Type viewModel:AccessoriesViewModel}">
            <local:AccessoriesView/>
        </DataTemplate>

        <DataTemplate DataType="{x:Type viewModel:LaptopViewModel}">
            <local:LaptopView/>
        </DataTemplate>
        
        <DataTemplate DataType="{x:Type viewModel:PhoneViewModel}">
            <local:PhoneView/>
        </DataTemplate>

        <DataTemplate DataType="{x:Type viewModel:ProfileViewModel}">
            <local:ProfileView/>
        </DataTemplate>
    </Window.Resources>
    
    <Border CornerRadius="16"
            BorderThickness="1"
            Background="{StaticResource panelColorMain}"
            >
            
        <Border.BorderBrush>
            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                <GradientStop Color="{StaticResource winBorderColor1}" Offset="0.0"/>
                <GradientStop Color="{StaticResource winBorderColor2}" Offset="0.5"/>
                <GradientStop Color="{StaticResource winBorderColor3}" Offset="1.0"/>
            </LinearGradientBrush>
        </Border.BorderBrush>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Border CornerRadius="16"
                    Grid.Column="0"
                    Background="{StaticResource panelColorNav}"
                    >

                <StackPanel>

                    <Grid Margin="16 16 0 0">

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="40"/>
                            <ColumnDefinition Width="40"/>
                        </Grid.ColumnDefinitions>

                        <Button x:Name="btnClose" 
                                BorderThickness="0"
                                Content="X"
                                Foreground="{StaticResource secondaryTextColor}"
                                FontSize="16"
                                FontFamily="Montserrat"
                                Cursor="Hand"
                                Grid.Column="0"
                                Click="btnClose_Click"
                                >

                            <Button.Style>
                                <Style TargetType="Button">
                                    <Setter Property="Background" Value="{StaticResource primaryButtonColor}"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="{StaticResource primaryButtonHoverColor}"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Button.Style>

                            <Button.Template>
                                <ControlTemplate TargetType="Button">
                                    <Border Width="30" Height="30"
                                            CornerRadius="15"
                                            Background="{TemplateBinding Background}">

                                        <ContentPresenter VerticalAlignment="Center"
                                            HorizontalAlignment="Center"/>

                                    </Border>
                                </ControlTemplate>
                            </Button.Template>

                        </Button>

                        <Button x:Name="btnMinimize" 
                                BorderThickness="0"
                                Content="-"
                                Foreground="{StaticResource secondaryTextColor}"
                                FontSize="25"
                                FontFamily="Montserrat"
                                Cursor="Hand"
                                Grid.Column="1"
                                Click="btnMinimize_Click"
                                >

                            <Button.Style>
                                <Style TargetType="Button">
                                    <Setter Property="Background" Value="{StaticResource secondaryButtonColor}"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="{StaticResource secondaryButtonHoverColor}"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Button.Style>

                            <Button.Template>
                                <ControlTemplate TargetType="Button">
                                    <Border Width="30" Height="30" 
                              CornerRadius="15"
                              Background="{TemplateBinding Background}">

                                        <ContentPresenter VerticalAlignment="Center"
                                            HorizontalAlignment="Center"/>

                                    </Border>
                                </ControlTemplate>
                            </Button.Template>

                        </Button>


                    </Grid>

                    <StackPanel Orientation="Horizontal"
                                Width="280"
                                HorizontalAlignment="Left"
                                Margin="8 16 22 50">

                        <Image Source="/Images/LogoName.png" Height="70" Width="230"/>

                    </StackPanel>

                    <RadioButton Command="{Binding ShowHomeViewCommand}"
                                 Style="{StaticResource menuButton}"
                                 Tag="{StaticResource activePageColor}"
                                 IsChecked="True">

                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Images/Menu/Home.png" Style="{StaticResource menuButtonIcon}"/>
                            <TextBlock Text="Каталог" Style="{StaticResource menuButtonText}"/>
                        </StackPanel>

                    </RadioButton>

                    <RadioButton Command="{Binding ShowReadyComputerViewCommand}"
                                 Style="{StaticResource menuButton}"
                                 Tag="{StaticResource activePageColor}"
                                 >

                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Images/Menu/ReadyComputer.png" Style="{StaticResource menuButtonIcon}"/>
                            <TextBlock Text="Готовые ПК" Style="{StaticResource menuButtonText}"/>
                        </StackPanel>

                    </RadioButton>

                    <RadioButton Command="{Binding ShowAccessoriesViewCommand}"
                                 Style="{StaticResource menuButton}"
                                 Tag="{StaticResource activePageColor}"
                                 >   

                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Images/Menu/Accessories.png" Style="{StaticResource menuButtonIcon}"/>
                            <TextBlock Text="Комплектующие" Style="{StaticResource menuButtonText}"/>
                        </StackPanel>

                    </RadioButton>

                    <RadioButton Command="{Binding ShowLaptopViewCommand}"
                                 Style="{StaticResource menuButton}"
                                 Tag="{StaticResource activePageColor}"
                                 >

                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Images/Menu/Laptop.png" Style="{StaticResource menuButtonIcon}"/>
                            <TextBlock Text="Ноутбуки" Style="{StaticResource menuButtonText}"/>
                        </StackPanel>

                    </RadioButton>

                    <RadioButton Command="{Binding ShowPhoneViewCommand}"
                                 Style="{StaticResource menuButton}"
                                 Tag="{StaticResource activePageColor}"
                                 >

                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Images/Menu/Phone.png" Style="{StaticResource menuButtonIcon}"/>
                            <TextBlock Text="Телефоны" Style="{StaticResource menuButtonText}"/>
                        </StackPanel>

                    </RadioButton>

                </StackPanel>
                
            </Border>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>


                <Button Content="Выйти"
                        Grid.Row="2"
                        BorderThickness="0"
                        Foreground="{StaticResource secondaryTextColor}"
                        FontSize="16"
                        FontFamily="Montserrat"
                        Cursor="Hand"
                        Grid.Column="1"
                        Margin="0 0 0 45"
                        Click="Exit_Click"
                        >

                    <Button.Style>
                        <Style TargetType="Button">
                            <Setter Property="Background" Value="{StaticResource primaryButtonColor}"/>
                            <Style.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="{StaticResource primaryButtonHoverColor}"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>

                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <Border Width="180" Height="60"
                                    CornerRadius="16"
                                    Background="{TemplateBinding Background}">

                                <ContentPresenter VerticalAlignment="Center"
                                                  HorizontalAlignment="Center"/>

                            </Border>
                        </ControlTemplate>
                    </Button.Template>

                </Button>

            </Grid>

            <Border CornerRadius="0 10 10 0" 
                    Grid.Column="1"
                    Margin="32 32 32 46">

                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="100"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <StackPanel Orientation="Horizontal">
                        <TextBlock Foreground="{StaticResource primaryTextColor}"
                                   FontSize="35"
                                   FontFamily="Montserrat"
                                   Width="100"
                                   Height="80"
                                   HorizontalAlignment="Left"
                                   FontWeight="Bold"
                                   VerticalAlignment="Top"
                                   
                                   Margin="0 0 20 0"
                                   >
                            
                            <Run Text="Ever"/>
                            <LineBreak/>
                            <Run Text="Green"/>
                        
                        </TextBlock>

                        <Border CornerRadius="30"
                                Background="{StaticResource panelColorNav}"
                                Height="60"
                                Width="700"
                                HorizontalAlignment="Right"
                                Margin="0 0 35 0"
                                >
                            <StackPanel Orientation="Horizontal">
                                <Border CornerRadius="20"
                                        Background="{StaticResource panelColorMain}"
                                        Width="500"
                                        Height="40"
                                        HorizontalAlignment="Left"
                                        Margin="10 0 15 0"
                                        >
                                        
                                    <TextBox Text=""
                                             FontSize="30"
                                             Width="480"
                                             Height="30"
                                             FontWeight="Medium"
                                             FontFamily="Montserrat"
                                             CaretBrush="{StaticResource markerColor}"
                                             HorizontalAlignment="Left"
                                             Margin="10 0 0 0"
                                             Padding="20 0 0 0"
                                             BorderThickness="0"
                                             >

                                        <TextBox.Background>
                                            <ImageBrush ImageSource="/Images/Search.png"
                                                        Stretch="none"
                                                        AlignmentX="Left"
                                                        />     
                                        </TextBox.Background>
                                    </TextBox>
                                    
                                </Border>
                                
                                <Button Content="Поиск"
                                        BorderThickness="0"
                                        Foreground="{StaticResource secondaryTextColor}"
                                        FontSize="16"
                                        FontFamily="Montserrat"
                                        Cursor="Hand"
                                        >

                                    <Button.Style>
                                        <Style TargetType="{x:Type Button}">
                                            <Setter Property="Background" Value="{StaticResource primaryButtonColor}"/>
                                            <Style.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter Property="Background" Value="{StaticResource primaryButtonHoverColor}"/>
                                                </Trigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Button.Style>

                                    <Button.Template>
                                        <ControlTemplate TargetType="{x:Type Button}">
                                            <Border Width="150" Height="40"
                                                        CornerRadius="16"
                                                        Background="{TemplateBinding Background}">

                                                <ContentPresenter VerticalAlignment="Center"
                                                                      HorizontalAlignment="Center"/>

                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>

                                </Button>

                            </StackPanel>
                        </Border>

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="70"/>
                                <ColumnDefinition Width="70"/>
                                <ColumnDefinition Width="70"/>
                            </Grid.ColumnDefinitions>
                            
                            <Image Source="/Images/LikeProduct.png" 
                                   Width="50" 
                                   Height="50"
                                   Grid.Column="0"
                                   />

                            <Image Source="/Images/Cart.png" 
                                   Width="60" 
                                   Height="60"
                                   Grid.Column="1"
                                   />

                            <Button Command="{Binding ShowProfileViewCommand}"
                                    Background="{StaticResource panelColorMain}"
                                    Width="50"
                                    Height="50"
                                    BorderThickness="0"
                                    Grid.Column="2" 
                                    Cursor="Hand"
                                    >

                                <Image>
                                    <Image.Style>
                                        <Style TargetType="Image">
                                            <Setter Property="Source" Value="{Binding CurrentUser.PhotoUser}" />
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding CurrentUser.PhotoUser}" Value="{x:Null}">
                                                    <Setter Property="Source" Value="/Images/Default_profile_image.png" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Image.Style>
                                </Image>

                                <Button.Style>
                                    <Style TargetType="Button">
                                        <Setter Property="Background" Value="Transparent"/>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background" Value="Transparent"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Button.Style>

                                <Button.Template>
                                    <ControlTemplate TargetType="Button">
                                        <Border CornerRadius="15"
                                                Background="{TemplateBinding Background}">

                                            <ContentPresenter VerticalAlignment="Center"
                                                              HorizontalAlignment="Center"/>

                                        </Border>
                                    </ControlTemplate>
                                </Button.Template>

                            </Button>

                        </Grid>
                        
                    </StackPanel>

                    <Border Grid.Row="2"
                            Margin="0 30 0 0"
                            >    

                        <ContentControl Content="{Binding BaseViewModel}"/>
                    </Border>
                </Grid>
                
            </Border>
        </Grid>
    </Border>

</Window>
